package com.pxample.config;

import io.grpc.*;

public class CustomClientInterceptor implements ClientInterceptor {
    Metadata metadata;

    public CustomClientInterceptor(Metadata metadata){
        this.metadata = metadata;
    }

    @Override
    public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> methodDescriptor, CallOptions callOptions, Channel next) {
        ClientCall<ReqT, RespT> call = next.newCall(methodDescriptor, callOptions);
        call = new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(call) {
            @Override
            public void start(Listener<RespT> responseListener, Metadata headers) {
                super.start(responseListener, metadata);
            }
        };
        return call;

    }
}
